<?php
require('../conn.php');
require('../functions.php');
require('ksession.php');
// var_dump($userdata)
$rows=$mysql->query("select * from `kaddata`");
// var_dump($rows)
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        <head>
               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>试玩软件</title>
        <base href="." />
        <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        <meta name="format-detection" content="telephone=no" />
        <link href="css/index.css" rel="stylesheet" type="text/css" />
        <link href="css/iscroll.css" rel="stylesheet" type="text/css" />
        <style>
            .todayList li.only4 a {
                padding: 5px 40px 4px 5px;
            }
            .todayList li .img {
                border-radius: 3px;
                height: 60px;/*图片高度*/
                width: 60px;/*图片宽度*/
                margin: 0 10px 0 0;
            } 
            .todayList li img {
                width: 60px;/*图片宽度*/
            }
            .todayList li p.onlyheight {
                height: 32px;/*分类描述*/
            }
            .todayList li.only4 p {
                white-space: normal;
            }	

        </style>
        <script src="js/iscroll.js" type="text/javascript"></script>
        <script type="text/javascript">
            var myScroll;

            function loaded() {
                myScroll = new iScroll('wrapper', {
                    snap: true,
                    momentum: false,
                    hScrollbar: false,
                    onScrollEnd: function () {
                        document.querySelector('#indicator > li.active').className = '';
                        document.querySelector('#indicator > li:nth-child(' + (this.currPageX+1) + ')').className = 'active';
                    }
                });
 
            }

            document.addEventListener('DOMContentLoaded', loaded, false);
        </script>

    </head>
    <body id="cate4">
    <!--背景音乐-->
        <div class="banner">
		<div id="wrapper">
			<div id="scroller">
				<ul id="thelist"> 
				<li><p></p><a href="http://www.weixinyunduan.com/gzzh/artview-1.html?wid=272184&rid=208945&wecha_id="><img src="http://weixin.gycode.com/uploads/f/fubsay1449127486/a/e/b/6/thumb_5667ed6c9d1ff.PNG" /></a></li><li><p></p><a href="javascript:void(0)"><img src="http://weixin.gycode.com/uploads/f/fubsay1449127486/2/e/b/2/thumb_5660753185e9f.JPG" /></a></li><li><p></p><a href="http://www.weixinyunduan.com/weiweb/272184/index.html?&wecha_id="><img src="http://weixin.gycode.com/uploads/f/fubsay1449127486/f/2/8/a/thumb_567967d89cabf.JPG" /></a></li>				</ul>
			</div>
		</div>
		<div id="nav">
			<div id="prev" onclick="myScroll.scrollToPage('prev', 0,400,3);return false">&larr; prev</div>
			<ul id="indicator">
			<li   class="active"  >1</li><li     >2</li><li     >3</li>			 
			</ul>
			<div id="next" onclick="myScroll.scrollToPage('next', 0);return false">next &rarr;</div>
		</div>
		<div class="clr"></div>
		</div>
            <div id="insert1"></div>
        <div id="todayList">
            <ul class="todayList">
            <?php
                foreach ($rows as $row) {
                print <<<div
                    <li class="only4" style="padding:10px 0 0 0">
                    <a href="share.php?aid={$row['id']}">
                        <div class="img"><img src="{$row['kad_logo']}" /></div>
                        <h2>{$row['kad_title']}</h2>
                        <p class="onlyheight">{$row['kad_profile']}</p>
                        <span class="icon">&nbsp;</span>
                        <div class="clr"></div>
                    </a>
                </li>
div;
                }
            ?>
            </ul>
        </div>
        <script>


            var count = document.getElementById("thelist").getElementsByTagName("img").length;	


            for(i=0;i<count;i++){
                document.getElementById("thelist").getElementsByTagName("img").item(i).style.cssText = " width:"+document.body.clientWidth+"px";

            }

            document.getElementById("scroller").style.cssText = " width:"+document.body.clientWidth*count+"px";


            setInterval(function(){
                myScroll.scrollToPage('next', 0,400,count);
            },3500 );

            window.onresize = function(){ 
                for(i=0;i<count;i++){
                    document.getElementById("thelist").getElementsByTagName("img").item(i).style.cssText = " width:"+document.body.clientWidth+"px";

                }

                document.getElementById("scroller").style.cssText = " width:"+document.body.clientWidth*count+"px";
            } 

        </script>
        <div id="insert2"></div>
        <div style="display:none"> </div>
<!-- 客服代码start -->
<!-- 客服代码end -->
<div class="copyright">
</div> 
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js" type="text/javascript"></script>
<script>
function displayit(n){
	for(i=0;i<4;i++){
		if(i==n){
			var id='menu_list'+n;
			if(document.getElementById(id).style.display=='none'){
				document.getElementById(id).style.display='';
				document.getElementById("plug-wrap").style.display='';
			}else{
				document.getElementById(id).style.display='none';
				document.getElementById("plug-wrap").style.display='none';
			}
		}else{
			if($('#menu_list'+i)){
				$('#menu_list'+i).css('display','none');
			}
		}
	}
}
function closeall(){
	var count = document.getElementById("top_menu").getElementsByTagName("ul").length;
	for(i=0;i<count;i++){
		document.getElementById("top_menu").getElementsByTagName("ul").item(i).style.display='none';
	}
	document.getElementById("plug-wrap").style.display='none';
}

document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
	WeixinJSBridge.call('hideToolbar');
});
</script>   
<!-- share -->

			<script type="text/javascript">
			window.shareData = {  
				"moduleName":"NewsList",
				"moduleID": "2367",
				"imgUrl": "http://weixin.gycode.com/uploads/f/fubsay1449127486/3/a/c/a/thumb_568a26264a0e2.jpg", 
				"timeLineLink": "http://weixin.gycode.com/index.php?g=Wap&m=Index&a=lists&token=fubsay1449127486&classid=2367",
				"sendFriendLink": "http://weixin.gycode.com/index.php?g=Wap&m=Index&a=lists&token=fubsay1449127486&classid=2367",
				"weiboLink": "http://weixin.gycode.com/index.php?g=Wap&m=Index&a=lists&token=fubsay1449127486&classid=2367",
				"tTitle": "苹果",
				"tContent": "最全最专业的试玩平台等你来赚~"
			};
		</script>	
	<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script type="text/javascript">
		wx.config({
		  debug: false,
		  appId: 	'wx9a6612bcff1a1b46',
		  timestamp: 1452130894,
		  nonceStr: '320632',
		  signature: '79974dda6586c6c6b94b282b88ab41e665d3514a',
		  jsApiList: [
	    	'checkJsApi',
		    'onMenuShareTimeline',
		    'onMenuShareAppMessage',
		    'onMenuShareQQ',
		    'onMenuShareWeibo',
			'openLocation',
			'getLocation',
			'addCard',
			'chooseCard',
			'openCard',
			'hideMenuItems'
		  ]
		});
	</script>
	<script type="text/javascript">
	wx.ready(function () {
	  // 1 判断当前版本是否支持指定 JS 接口，支持批量判断
	  /*document.querySelector('#checkJsApi').onclick = function () {
	    wx.checkJsApi({
	      jsApiList: [
	        'getNetworkType',
	        'previewImage'
	      ],
	      success: function (res) {
	        //alert(JSON.stringify(res));
	      }
	    });
	  };*/
	  // 2. 分享接口
	  // 2.1 监听“分享给朋友”，按钮点击、自定义分享内容及分享结果接口
	    wx.onMenuShareAppMessage({
			title: window.shareData.tTitle,
			desc: window.shareData.tContent,
			link: window.shareData.sendFriendLink,
			imgUrl: window.shareData.imgUrl,
		    type: '', // 分享类型,music、video或link，不填默认为link
		    dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
		    success: function () { 
				shareHandle('frined');
		    },
		    cancel: function () { 
		        //alert('分享朋友失败');
		    }
		});


	  // 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口
		wx.onMenuShareTimeline({
			title: window.shareData.fTitle?window.shareData.fTitle:window.shareData.tTitle,
			link: window.shareData.sendFriendLink,
			imgUrl: window.shareData.imgUrl,
		    success: function () { 
				shareHandle('frineds');
		        //alert('分享朋友圈成功');
		    },
		    cancel: function () { 
		        //alert('分享朋友圈失败');
		    }
		});	

	  // 2.4 监听“分享到微博”按钮点击、自定义分享内容及分享结果接口
		wx.onMenuShareWeibo({
			title: window.shareData.tTitle,
			desc: window.shareData.tContent,
			link: window.shareData.sendFriendLink,
			imgUrl: window.shareData.imgUrl,
		    success: function () { 
				shareHandle('weibo');
		       	//alert('分享微博成功');
		    },
		    cancel: function () { 
		        //alert('分享微博失败');
		    }
		});
		if(window.shareData.timeline_hide == '1'){
			wx.hideMenuItems({
			  menuList: [
				'menuItem:share:timeline', //隐藏分享到朋友圈
			  ],
			});
		}
		wx.error(function (res) {
			/*if(res.errMsg == 'config:invalid signature'){
				wx.hideOptionMenu();
			}else if(res.errMsg == 'config:invalid url domain'){
				wx.hideOptionMenu();
			}else{
				wx.hideOptionMenu();
				//alert(res.errMsg);
			}*/
			if(res.errMsg){
				wx.hideOptionMenu();
			}
		});
	});
		
	function shareHandle(to) {
		var submitData = {
			module: window.shareData.moduleName,
			moduleid: window.shareData.moduleID,
			token:'fubsay1449127486',
			wecha_id:'',
			url: window.shareData.sendFriendLink,
			to:to
		};

		$.post('index.php?g=Wap&m=Share&a=shareData&token=fubsay1449127486&wecha_id=',submitData,function (data) {},'json');
		if(window.shareData.isShareNum == 1){
			var ShareNum = {
				token:'fubsay1449127486',
				ShareNumData:window.shareData.ShareNumData
			}
			$.post('index.php?g=Wap&m=Share&a=ShareNum&token=fubsay1449127486&wecha_id=',ShareNum,function (data) {},'json');
		}
	}
</script>
<?php
$mysql->__destruct();
$mysql->close();
?>
</body></html>